<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Statement" %><%--
  Created by IntelliJ IDEA.
  User: 发
  Date: 2020/10/9
  Time: 10:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<jsp:useBean id="user" class="user"></jsp:useBean>
<jsp:setProperty name="user" property="*"></jsp:setProperty>

<%
    Class.forName("com.mysql.jdbc.Driver");

    String url2="jdbc:mysql://127.0.0.1:3306/yxl?user=root&password=root";
    Connection connection2 = DriverManager.getConnection(url2);

    Statement stmt2 =connection2.createStatement();

    String sql2 ="insert into user(username,password,gender,age) values("+user.getUsername()+","+user.getPassword()+",1,12)";
    int count2 =stmt2.executeUpdate(sql2);

    if(count2>0){
        out.print("注册成功");
    }else{
        out.print("注册失败");
    }
%>
